package mobi.greenplate.client.handler;

import mobi.greenplate.client.converter.UserConverter;
import mobi.greenplate.client.domain.User;
import mobi.greenplate.client.parser.DomainHandler;

/**
 *
 * @author dmakariev
 */
public class UserHandler extends DomainHandler<User> {

    private static final String USER_ROOT = "//user";
    private User user = new User();

    @Override
    public User getEntity() {
        return user;
    }

    @Override
    public void endTag(String parentPath, String tagName, String text) {
        if (USER_ROOT.equalsIgnoreCase(parentPath)) {
            user = UserConverter.endTag(user, tagName, text);
        }
    }

    @Override
    public void startTag(String parentPath, String tagName) {
        //do nothing
    }
}
